<template>
  <yd-button :type="type" :size="size" :bgcolor="bgcolor" :color="color" :disabled="disabled" :shape="shape" :action-type="actionType" :loading="loading" :loading-color="loadingColor" :loading-txt="loadingTxt">{{buttonText}}</yd-button>
</template>

<script>
// import 'vue-ydui/dist/ydui.base.css'
import {VueExtend} from 'godspen-lib'
import {Button} from 'vue-ydui/dist/lib.px/button'

export default {
  mixins: [VueExtend.mixin],
  name: 'ydui_button',
  label: process.env.LABEL,
  style: process.env.STYLE,
  stack: null, // 是否是堆叠模式 ，false：孩子元素会按楼层一个个向下排布， true: 孩子元素绝对定位，随意放置位置
  childLimit: 9999,  // 孩子元素最大限制数
  leaf: true, // 是否是叶子节点，为true的时候该节点下面不能添加节点
  props: {
    buttonText: {
      type: String,
      default: '按钮',
      editor: {
        label: '按钮文案',
        desc: '自定义按钮文案',
        type: 'input'
      }
    },
    type: {
      type: String,
      default: 'primary',
      editor: {
        label: '按钮类型',
        desc: '',
        type: 'enum',
        defaultList: {
          'primary': 'primary',
          'danger': 'danger',
          'warning': 'warning',
          'hollow': 'hollow',
          'disabled': 'disabled'
        }
      }
    },
    size: {
      type: String,
      default: 'large',
      editor: {
        label: '按钮尺寸',
        desc: '',
        type: 'enum',
        defaultList: {
          'mini': '小号',
          'small': '中等',
          'large': '大号'
        }
      }
    },
    bgcolor: {
      type: String,
      default: '',
      editor: {
        label: '背景颜色',
        desc: '自定义背景颜色',
        type: 'input'
      }
    },
    color: {
      type: String,
      default: '',
      editor: {
        label: '文字颜色',
        desc: '自定义文字颜色',
        type: 'input'
      }
    },
    disabled: {
      type: Boolean,
      default: false,
      editor: {
        label: '是否禁用',
        desc: '设置按钮禁用',
        type: 'checkbox'
      }
    },
    shape: {
      type: String,
      default: 'square',
      editor: {
        label: '按钮圆角',
        desc: '',
        type: 'enum',
        defaultList: {
          'square': '小圆角',
          'circle': '大圆角',
          'angle': '无圆角'
        }
      }
    },
    actionType: {
      type: String,
      default: 'button',
      editor: {
        label: '渲染类型',
        desc: '',
        type: 'enum',
        defaultList: {
          'button': '普通按钮',
          'submit': '提交按钮',
          'reset': '重置按钮'
        }
      }
    },
    loading: {
      type: Boolean,
      default: false,
      editor: {
        label: '加载状态',
        desc: '设置按钮是否处于加载状态',
        type: 'checkbox'
      }
    },
    loadingColor: {
      type: String,
      default: '',
      editor: {
        label: '图标颜色',
        desc: '自定义加载中图标颜色',
        type: 'input'
      }
    },
    loadingTxt: {
      type: String,
      default: '加载中',
      editor: {
        label: '加载文案',
        desc: '自定义加载中按钮文案',
        type: 'input'
      }
    }
  },
  components: {
    [Button.name]: Button
  },
  computed: {
  },
  editorMethods: {
  },
  methods: {
  }
}
</script>

<style lang="stylus" rel="stylesheet/stylus" type="text/stylus" scoped>
.yd-btn-block {
  margin-top: 0;
}
</style>